<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<p id="p"></p>
<script>
// http://localhost:8080/1703/Day08_2/01_location.html?_ijt=qs3bul36qgeiof6p7q8950dq9n
var msg = "协议:" + location.protocol +
 "<br> 主机:" + location.host +   // 包含主机名和端口号
 "<br> 主机名:" + location.hostname +
 "<br> 端口号:" + location.port +
 "<br> 路径:" + location.pathname +
 "<br> 查询参数:" + location.search +
 "<br> url: " + location.href  // 返回完整的 url
p.innerHTML = msg;

var search = location.search.slice(1);
var ss = search.split("&")
for(var s of ss){
    var t = s.split("=")
    console.log(t);
}

</script>
</body>
</html>
<!--
1-65535
1-1024 被占用
80 http 默认端口
22 ftp

8080
8888
url:
协议://主机名:端口号/资源路径?username=lisi

http://localhost:8080/1703/Day08_2/%E6%98%A8%E6%97%A5%E4%BD%9C%E4%B8%9A/%E4%BD%9C%E4%B8%9A1.html?_ijt=tv394ajf2jk9g7chpci6o4fpdb
-->